//载入基础页面
{extend name="common/base" /}

//页面单独CSS
{block name="CustomCSS"}

{/block}

//页面单独JS
{block name="CustomJS"}
<script src="__STATIC__/vendors/js/validation/validation.min.js"></script>
<script src="__STATIC__/vendors/js/jquery.form/jquery.form.min.js"></script>
<script src="__STATIC__/vendors/js/noty/noty.min.js"></script>
<script src="__STATIC__/vendors/js/daterangepicker/moment.min.js"></script>
<script src="__STATIC__/vendors/js/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript">
	$(document).ready(function () {
		//single date
		$('#date').daterangepicker({
			singleDatePicker: true,
			locale: {
				format:'YYYY-MM-DD',
			}
		});
        $("#ajaxForm").ajaxForm({
            //定义返回JSON数据，还包括xml和script格式
            dataType: 'json',
			//在发送之前进行的操作，如果有问题，返回false即可不会进行提交
            beforeSend: function () {
            	//定义 form为当前表格
                const form = $("#ajaxForm")

				//如果没有完成校验就返回false不提交
				if (form[0].checkValidity() === false){
					return false;
				}
            },
            success: function (data) {
                //提交成功后调用
                new Noty({
		            type: "success",
		            layout: "topRight",
		            text: "成功新增一条数据，ID为" + data,
		            progressBar: true,
		            timeout: 2500,
		            animation: {
		                open: "animated bounceInRight",
		                close: "animated bounceOutRight"
		            },
		            callbacks: {
		            	afterShow: function() {
		            		$(location).attr('href', '{:url('internet/index')}');
		            	},
		            }
		        }).show();
                return false;
            },
            error: function(XmlHttpRequest, textStatus, errorThrown){  
                //提交成功后调用
                new Noty({
		            type: "error",
		            layout: "topRight",
		            text: "数据添加失败",
		            progressBar: true,
		            timeout: 2500,
		            animation: {
		                open: "animated bounceInRight",
		                close: "animated bounceOutRight"
		            }
		        }).show();
		        return false;
            } 
        });
	});
</script>
{/block}

//页面显示名称
{block name="PageName"}
添加每日网销数据
{/block}

//主页面代码
{block name="main"}
<div class="row">
    <div class="col-xl-12">
        <div class="widget has-shadow">
        	<div class="widget-header bordered no-actions d-flex align-items-center">
                <h2>添加每日网销数据</h2>
            </div>
            <div class="widget-body">
                <form class="needs-validation" novalidate="" id="ajaxForm" action="{:url('internet/save')}">
                	<div class="form-group row">
                        <label class="col-xl-3 form-control-label" for="date">日期</label>
                        <div class="col-xl-9">
                            <div class="form-group">
                                <div class="input-group">
                                    <input type="date" class="form-control" id="date" placeholder="选择日期" required name="create_date">
                                    <div class="invalid-feedback">
			                            请输入今天的日期
			                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-xl-3 form-control-label">汽车之家</label>
                        <div class="form-group col-xl-9">
                            <div class="form-group row">
                                <div class="col">
                                    <input type="number" placeholder="线索" class="form-control" required name="autohome_count">
                                    <div class="invalid-feedback">
			                            请输入汽车之家线索
			                        </div>
                                </div>
                                <div class="col">
                                    <input type="number" placeholder="有效线索" class="form-control" required name="autohome_valid">
                                    <div class="invalid-feedback">
			                            请输入汽车之家有效线索
			                        </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col">
                                    <input type="number" placeholder="邀约" class="form-control" required name="autohome_invite">
                                    <div class="invalid-feedback">
			                            请输入汽车之家邀约
			                        </div>
                                </div>
                                <div class="col">
                                    <input type="number" placeholder="订单" class="form-control" required name="autohome_order">
                                    <div class="invalid-feedback">
			                            请输入汽车之家订单
			                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-xl-3 form-control-label">易车</label>
                        <div class="form-group col-xl-9">
                            <div class="form-group row">
                                <div class="col">
                                    <input type="number" placeholder="线索" class="form-control" required name="yiche_count">
                                    <div class="invalid-feedback">
			                            请输入易车线索
			                        </div>
                                </div>
                                <div class="col">
                                    <input type="number" placeholder="有效线索" class="form-control" required name="yiche_valid">
                                    <div class="invalid-feedback">
			                            请输入易车有效线索
			                        </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col">
                                    <input type="number" placeholder="邀约" class="form-control" required name="yiche_invite">
                                    <div class="invalid-feedback">
			                            请输入易车邀约
			                        </div>
                                </div>
                                <div class="col">
                                    <input type="number" placeholder="订单" class="form-control" required name="yiche_order">
                                    <div class="invalid-feedback">
			                            请输入易车订单
			                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-xl-3 form-control-label">其它</label>
                        <div class="form-group col-xl-9">
                            <div class="form-group row">
                                <div class="col">
                                    <input type="number" placeholder="线索" class="form-control" required name="other_count" value="0">
                                    <div class="invalid-feedback">
			                            请输入其它线索
			                        </div>
                                </div>
                                <div class="col">
                                    <input type="number" placeholder="有效线索" class="form-control" required name="other_valid" value="0">
                                    <div class="invalid-feedback">
			                            请输入其它有效线索
			                        </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col">
                                    <input type="number" placeholder="邀约" class="form-control" required name="other_invite" value="0">
                                    <div class="invalid-feedback">
			                            请输入其它邀约
			                        </div>
                                </div>
                                <div class="col">
                                    <input type="number" placeholder="订单" class="form-control" required name="other_order" value="0">
                                    <div class="invalid-feedback">
			                            请输入其它订单
			                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-xl-3 form-control-label">今日交车</label>
                        <div class="form-group col-xl-9">
                            <div class="row">
                                <div class="col">
                                    <input type="number" placeholder="今日交车" class="form-control" required name="today_delivery">
                                    <div class="invalid-feedback">
			                            请输入今日交车
			                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
	                <div class="text-right">
		                <button class="btn btn-shadow" type="reset" onclick="history.go(-1);">取消</button>
		                <button class="btn btn-gradient-01" type="submit">提交</button>
		            </div>
		        </form>
            </div>
        </div>
        <!-- End Export -->
    </div>
</div>

{/block}//主页面

//自定义Modal
{block name="Modal"}
{/block}
